//
// Created by wuzhe on 2022/4/18.
//

#include "OnlineState.h"
#include "InRoomState.h"

OnlineState::OnlineState(Player &player):PlayerState(player, PLAYER_STATUS::ONLINE) {
    player.updatePlayerInfo();
}

PlayerState *OnlineState::getCreateRoom(std::string roomName) {
    std::string content("create room:");
    content += roomName;
    INFO(content);
    player.createRoom(roomName);
    return nullptr;
}

PlayerState *OnlineState::getEnterRoom(int roomId) {
    player.onEnterRoom(roomId);
    INFO(std::string("player ") + player.IP + " status changed: online->in room");
    return new InRoomState(player);

}
